#lang racket


(provide (struct-out domain))


(define (domain-print domain port mode)
  (if (eq? (domain-min-s domain) 'open)
      (write-string "]" port)
      (write-string "[" port))
  (write-string (format "~a" (domain-min-val domain)) port)
  (write-string " " port)
  (write-string (format "~a" (domain-max-val domain)) port)
  (if (eq? (domain-max-s domain) 'open)
      (write-string "[" port)
      (write-string "]" port)))

(define-struct domain
  (min-s min-val max-s max-val)
  #:property prop:custom-write domain-print)